/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1624432800251_3296';

    // add your middleware config here
    config.middleware = [];


    config.security = {
        csrf: {
            enable: false,
            ignoreJSON: true
        },
        domainWhiteList: ['*']
    };

    config.cluster = {
        listen: {
            path: "3000",
            port: 8080,
            hostname: '0.0 .0 .0', //localhost
        }
    };

    config.mysql = {
        // 单数据库信息配置
        client: {
            // host: '127.0.0.1',
            host: '49.234.126.156',
            // 端口号
            port: '3306',
            // 用户名
            user: 'library',
            // user: 'root',
            // 密码
            password: '4H4ykbh6kNdWdpPP',
            // password: '123456',
            // 数据库名
            database: 'library',
            // database: 'library-shop',
        },
        // 是否加载到 app 上，默认开启
        app: true,
        // 是否加载到 agent 上，默认关闭
        agent: false,
    }

    // 跨域配置
    config.cors = {
        origin: '*',
        allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
    };
    config.swaggerdoc = {
        dirScanner: './app/controller', //插件扫描的文档路径
        apiInfo: {
            title: 'swagger文档',
            description: 'egg.js swagger-demo文档',
            version: '1.0.0'
        },
        consumes: ['application/json', 'multipart/form-data'], // 指定处理请求的提交内容类型（Content-Type），例如application/json, text/html
        produces: ['application/json', 'multipart/form-data'], // 指定返回的内容类型，仅当request请求头中的(Accept)类型中包含该指定类型才返回
        schemes: ['http', 'https'],
        routerMap: true, // 是否自动生成route
        enable: true,
    };

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };

    return {
        ...config,
        ...userConfig,
    };
};